feat: HIIT countdown timer with auto set/rest cycling#82
Open
hozaifa1 wants to merge 2 commits into
Open
Conversation
Adds support for HIIT-style autonomous timer flow: - Press play -> set countdown begins - Countdown reaches 0 -> rest timer auto-starts - Rest reaches 0 -> next set countdown auto-starts - Repeats until all sets are complete Implementation: - New Exercise fields: targetDuration (sec), autoAdvanceSets (bool) - New ExerciseDC field: cautions (common-mistakes text shown in info screen) - Room migration 3 -> 4 for the three new columns - WorkoutService gains countdown coroutine + StateFlows (countdownTime, isCountdownActive, countdownTotal, countdownFinished) - New service actions: START_COUNTDOWN, CANCEL_COUNTDOWN - WorkoutScreenViewModel: HiitPhase sealed class (Idle / SetCountdown / RestBetweenSets / ExerciseDone) plus observers that mark sets complete and auto-advance on rest expiry - New HiitCountdownCard composable: circular arc + phase label + play / cancel / skip-rest controls (orange=set, blue=rest, red=last 3s, green=done) - WorkoutScreen renders the card for DURATION exercises with targetDuration > 0 and autoAdvanceSets enabled - InfoExerciseScreen shows a "Common Mistakes" warning card when the exercise has non-empty cautions
IamDg
requested changes
May 22, 2026
Member
IamDg
left a comment
There was a problem hiding this comment.
I'm very disappointed by this work: no encapsulation, no testing, no compose previews, no best practices, just hardcoding, spaghetti code and vide coding! In addition, it doesn't build in CI and the actual feature in the app is even inaccessible as there isn't a way for the user to enter HIIT mode. Please, invest actual effort and time if you actually want to add real value to the project.
…iews Address review feedback on commit 127c7e5: - Add HiitSettingsCard exposed in the workout screen for DURATION exercises so users can actually enable HIIT auto-advance and pick a target duration. Without this the feature was unreachable. - Extract HiitPhase to a top-level sealed class with a pure nextPhaseAfterCountdown transition helper; unit-test the helper. - Rewrite HiitCountdownCard to use existing drawable resources and MaterialTheme.colorScheme instead of dragging in the unavailable androidx.compose.material:material-icons-extended library and hard-coding hex colours. - Move every user-facing HIIT string to strings.xml. - Add @Preview functions for all visual HIIT components (idle, set, rest, done, settings on/off). - Drop the ExerciseDC.cautions field and its 3->4 migration column. The dataset schema is defined by schemas/exercise-schema.json and must not be extended here; the field also had no UI to populate it. - Add a SessionStart hook so subsequent web sessions can run lintDebug, testDebugUnitTest, and assembleDebug locally. - Regenerate app/lint-baseline.xml: Room-generated code shifts line numbers when columns are added to the exercises entity. Stripped environment-only entries (AGP/Gradle/dependency-version notices). Verified locally with: ./gradlew lintDebug ./gradlew testDebugUnitTest ./gradlew assembleDebug
IamDg
requested changes
May 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for HIIT-style autonomous timer flow on duration-based exercises:
This unlocks Tabata / EMOM / circuit workouts where the user wants hands-free progression through a fixed work/rest cycle.
Changes
Data layer
Exercise: new fieldstargetDuration: IntandautoAdvanceSets: BooleanExerciseDC: new fieldcautions: String(common-mistakes text shown to the user)UiExercise,UiExerciseDC) and their mappers updated to matchService layer
WorkoutServicegains a countdown coroutine and four newStateFlows:countdownTime,isCountdownActive,countdownTotal,countdownFinishedSTART_COUNTDOWN,CANCEL_COUNTDOWNWorkoutServiceManagerexposesstartCountdown(duration, restDuration)andcancelCountdown()ViewModel
WorkoutScreenViewModel.HiitPhasesealed class:Idle/SetCountdown/RestBetweenSets/ExerciseDonecountdownFinished→ mark the set as completed, transition toRestBetweenSetsRestBetweenSets→ start the next set's countdownstartHiitCountdown/cancelHiitCountdown/resetHiitPhasefor screen controlUI
HiitCountdownCardcomposable with a circular progress arc and color-coded phaseWorkoutScreenrenders the card above the regularExerciseCardfor any exercise wheresetMode == DURATION && targetDuration > 0 && autoAdvanceSetsInfoExerciseScreenshows a "Common Mistakes" warning card on the Instructions tab whencautionsis non-empty (no-op for legacy exercises with empty cautions)Backward compatibility
0/false/""so legacy workouts are unaffectedautoAdvanceSetsisfalseTest plan
targetDuration=30,restTime=15,autoAdvanceSets=true, 3 setscautionsshow no warning card; an exercise withcautionsset shows the red warning card on the Instructions tabNotes
UI to edit
targetDuration/autoAdvanceSetsfrom the Edit-Exercise screen is not included in this PR — the fields are wired through the data and service layers and the runtime UI, but a follow-up PR can add the form controls. For now they can be set programmatically or via custom-exercise creation. Happy to split this further or fold the edit UI in if maintainers prefer.